<html>
  <head>
    <title>Line Anchor</title>
    <script type="text/javascript" src="../../protovis.js"></script>
    <style type="text/css">span { display: block !important; }</style>
  </head>
  <body>
    <script type="text/javascript+protovis">

var data = pv.range(10).map(function(x) ({x: x, y: Math.sin(x) + 2})),
    w = 400,
    h = 50,
    x = pv.Scale.linear(data, function(d) d.x).range(0, w),
    y = pv.Scale.linear(1, 3).range(0, h);

var vis = new pv.Panel()
    .data(["left", "top", "right", "bottom", "center"])
    .width(w)
    .height(h)
    .left(20)
    .right(20)
    .top(10)
    .bottom(10);

var line = vis.add(pv.Line)
    .data(data)
    .left(function(d) x(d.x))
    .bottom(function(d) y(d.y));

line.add(pv.Dot)
    .size(6)
    .strokeStyle("black")
    .fillStyle("white");

line.anchor(function(d, p) p).add(pv.Label)
    .text(function(d, p) p);

vis.render();

    </script>
  </body>
</html>
